/*
 * $HeadURL: $
 * $Id: $
 * Copyright (c) 2013 by Wodensoft System, all rights reserved.
 */
package com.wodensoft.core.exception;

/**
 * 系统通用异常
 * 
 * @author wodenwang
 * 
 */
@SuppressWarnings("serial")
public class SystemRuntimeException extends RuntimeException {
    /**
     * 额外说明<br>
     * 这里只需要添加有意义的说明，不需要写“请联系管理员”之类的友好信息。
     */
    private String extMessage;
    /**
     * 异常类型
     */
    private ExceptionType type;

    public SystemRuntimeException(ExceptionType type, String extMessage, Throwable e) {
        super(extMessage, e);
        this.type = type;
        this.extMessage = extMessage;
    }

    public SystemRuntimeException(ExceptionType type, String extMessage) {
        this(type, extMessage, null);
    }

    public SystemRuntimeException(ExceptionType type, Throwable e) {
        this(type, null, e);
    }

    public SystemRuntimeException(Throwable e) {
        this(SystemRuntimeException.getType(e), e);
    }

    public SystemRuntimeException(String extMessage, Throwable e) {
        this(SystemRuntimeException.getType(e), extMessage, e);
    }

    /**
     * 根据异常信息确定异常类型
     * 
     * @param e
     * @return
     */
    public static ExceptionType getType(Throwable e) {
        return ExceptionType.DEFAULT;// FIXME
    }

    /**
     * 根据异常类确定异常类型
     * 
     * @param cls
     * @return
     */
    public static ExceptionType getType(Class<Throwable> cls) {
        return ExceptionType.DEFAULT;// FIXME
    }

}
